<template>
  <div class="dashboard">
    <el-row :gutter="20">
      <el-col :span="6">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>Total Users</span>
              <el-icon><User /></el-icon>
            </div>
          </template>
          <div class="card-content">
            <h2>1,234</h2>
            <span class="trend up">+12%</span>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>Total Orders</span>
              <el-icon><ShoppingCart /></el-icon>
            </div>
          </template>
          <div class="card-content">
            <h2>567</h2>
            <span class="trend up">+8%</span>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>Revenue</span>
              <el-icon><Money /></el-icon>
            </div>
          </template>
          <div class="card-content">
            <h2>$12,345</h2>
            <span class="trend up">+15%</span>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="hover">
          <template #header>
            <div class="card-header">
              <span>Active Users</span>
              <el-icon><UserFilled /></el-icon>
            </div>
          </template>
          <div class="card-content">
            <h2>890</h2>
            <span class="trend down">-3%</span>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <el-row :gutter="20" class="chart-row">
      <el-col :span="12">
        <el-card>
          <template #header>
            <div class="card-header">
              <span>Sales Overview</span>
            </div>
          </template>
          <div class="chart-container">
            <!-- 这里可以添加图表组件 -->
            <div class="placeholder-chart">Chart will be here</div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="12">
        <el-card>
          <template #header>
            <div class="card-header">
              <span>User Activity</span>
            </div>
          </template>
          <div class="chart-container">
            <!-- 这里可以添加图表组件 -->
            <div class="placeholder-chart">Chart will be here</div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { User, ShoppingCart, Money, UserFilled } from '@element-plus/icons-vue'
</script>

<style scoped>
.dashboard {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-content {
  text-align: center;
}

.card-content h2 {
  margin: 10px 0;
  font-size: 24px;
}

.trend {
  font-size: 14px;
  padding: 2px 8px;
  border-radius: 4px;
}

.trend.up {
  color: #67c23a;
  background-color: #f0f9eb;
}

.trend.down {
  color: #f56c6c;
  background-color: #fef0f0;
}

.chart-row {
  margin-top: 20px;
}

.chart-container {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-chart {
  width: 100%;
  height: 100%;
  background-color: #f5f7fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #909399;
}
</style> 